package com.lxs.votesystem.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lxs.votesystem.bean.Channel;
import com.lxs.votesystem.service.ChannelService;
import com.lxs.votesystem.util.AjaxResult;

/**
 * 频道控制类
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/channel")
public class ChannelController {
	
	@Autowired
	private ChannelService channelService;

	/**
	 * 异步加载所有频道信息
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/list")
	public AjaxResult list() {
		// 调用service层,执行操作
		List<Channel> channelList = channelService.queryAllChannel();
		// 将结果返回
		return new AjaxResult(true, "成功", channelList);
	}
}
